import request from '@/utils/request_zc'

const get_check_stock_list = ({
  checkStockNo,
  materialName,
  warehouseName,
  areaName,
  locationName,
  batchNo,
  checkStockType,
  inventoryStartDate,
  inventoryEndDate,
  checkStockStartDate,
  checkStockEndDate,
  responsiblePerson,
  page,
  limit
}) => {
  return request({
    url: '/wms/check/stock/list',
    method: 'get',
    params: {
      checkStockNo,
      materialName,
      warehouseName,
      areaName,
      locationName,
      batchNo,
      checkStockType,
      inventoryStartDate,
      inventoryEndDate,
      checkStockStartDate,
      checkStockEndDate,
      responsiblePerson,
      page,
      limit
    }
  })
}


const edit_check_stock = ({
  actualStock,
  areaId,
  batchNo,
  checkStockDate,
  currentStock,
  id,
  inventoryDate,
  locationId,
  materialId,
  reason,
  responsiblePerson,
  warehouseId
}) => {
  return request({
    url: '/wms/check/stock/edit',
    method: 'post',
    data: {
      actualStock,
      areaId,
      batchNo,
      checkStockDate,
      currentStock,
      id,
      inventoryDate,
      locationId,
      materialId,
      reason,
      responsiblePerson,
      warehouseId
    }
  })
}

const add_check_stock = ({
  actualStock,
  areaId,
  batchNo,
  checkStockDate,
  currentStock,
  inventoryDate,
  locationId,
  materialId,
  reason,
  responsiblePerson,
  warehouseId
}) => {
  return request({
    url: '/wms/check/stock/add',
    method: 'post',
    data: {
      actualStock,
      areaId,
      batchNo,
      checkStockDate,
      currentStock,
      inventoryDate,
      locationId,
      materialId,
      reason,
      responsiblePerson,
      warehouseId
    }
  })
}

const del_check_stock = ({
  ids
}) => {
  return request({
    url: '/wms/check/stock/del',
    method: 'post',
    data: {
      ids
    }
  })
}


const get_area = ({
  materialId,
  warehouseId
}) => {
  return request({
    url: `/wms/material/inventory/area/${materialId}/${warehouseId}`,
    method: 'get',
  })
}

const get_tree = ({
  materialId,
}) => {
  return request({
    url: `/wms/material/inventory/warehouse/tree/${materialId}`,
    method: 'get',
  })
}

const get_material = () => {
  return request({
    url: `/wms/material/inventory/materialList`,
    method: 'get',
  })
}

const get_warehouse = ({
  id
}) => {
  return request({
    url: `/wms/material/inventory/warehouse/${id}`,
    method: 'get',
  })
}

const get_loaction = ({
  materialId,
  areaId
}) => {
  return request({
    url: `/wms/material/inventory/location/${materialId}/${areaId}`,
    method: 'get',
  })
}

const get_detail = ({
  materialId,
  locationId
}) => {
  return request({
    url: `/wms/material/inventory/detail/${materialId}/${locationId}`,
    method: 'get',
  })
}



export {
  get_check_stock_list,
  edit_check_stock,
  add_check_stock,
  del_check_stock,
  get_area,
  get_warehouse,
  get_loaction,
  get_tree,
  get_material,
  get_detail
}



